﻿using UnityEngine;

namespace Core.Experiment
{
    public class PropsComponent : Component, IAwake
    {
        public int MaxHP { get; private set; }
        public int CurHP { get; private set; }
        public int Attack { get; private set; }

        public bool IsDead { get; private set; }

        public void Awake()
        {
            MaxHP = 100;
            CurHP = 100;
            Attack = 10;
        }

        public void Hurt(PropsComponent attacker)
        {
            if (IsDead || attacker == null) return;

            CurHP -= attacker.Attack;

            Debug.LogError($"Hurt hp = {CurHP}");
            if (CurHP <= 0)
            {
                Debug.LogError($"Dead");
                IsDead = true;
                //role.Dead();
            }
        }
    }
}
